<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/js/jquery-1.8.0.js"></script>
    <script src="/js/my97/WdatePicker.js"></script>

    <!--引入uploadify的样式 -->
    <link rel="stylesheet" href="/js/uploadify/uploadify.css" />
    <script src="/js/uploadify/jquery.uploadify.min.js"></script>

    <!--引入kindedit的样式 -->
    <link rel="stylesheet" href="/js/kindeditor-4.1.10/themes/default/default.css"/>
    <script src="/js/kindeditor-4.1.10/kindeditor-all.js"></script>

    <!--引入easyui的样式 -->
    <link rel="stylesheet" href="/js/easyui1.5/themes/default/easyui.css" type="text/css"></link>
    <link rel="stylesheet" href="/js/easyui1.5/themes/icon.css" type="text/css"></link>

    <script type="text/javascript" src="/js/easyui1.5/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="js/easyui1.5/locale/easyui-lang-zh_CN.js"></script>
</head>
<body>
<input type="hidden" th:value="${name}" id="tablename"/>
<table id="dg" fit=true></table>

</body>
    <script type="text/javascript" th:inline="none">
        $(function(){
           queryBoo();
        })

        function queryBoo(){
            var  tableName=$("#tablename").val();

        $('#dg').datagrid({
            url:'/boo/queryBoo?name='+tableName,
            striped:true,
            toolbar: '#tb',
            pagination:true,
            pageList:[25,35,50,70],
            pageSize: 2, //默认显示多少条 这个值一定在pagelist中存在
            rowStyler: function(index,row){
                console.log(index)//当前行索引
                console.log(row)
                if (index%2==0){
                    return 'background-color:#6293BB;color:green;';
                }else{
                    return 'background-color:#6293BB;color:yellow;';
                }
            },
            columns:[[
                {field:"id",title:'序号',width:100,align:'center',
                    formatter: function(value,row,index){
                    return index+1;
                    }
                },
                {field:'bkname',title:'博客名',width:100,align:'center'},
                {field:'bzname',title:'博主名字',width:100,align:'center'},
                {field:'bkcount',title:'点击量',width:100,align:'center'},
                {field:'bktime',title:'博客时间',width:100,align:'center',
                    formatter: function(value,row,index){
                        console.log("==>"+value)
                        //字符串 转成日期对象
                        var mydate = new Date(value)//格式化日期
                        var str = mydate.toLocaleDateString()//日期对象的方法
                        return str;
                    } },


            ]]
        });
        }
    </script>
</html>